<template>
    <div class="m-b" v-if="isMultiple || isGroup">
        <p class="m-b">分组设置</p>
        <n-button v-if="isMultiple" tertiary type="primary" round @click="handleUpdateValue(true)">
            合成分组
        </n-button>
        <n-button v-if="isGroup" tertiary type="warning" round @click="handleUpdateValue(false)">
            拆开分组
        </n-button>
    </div>
</template>

<script setup name="Group">
import useSharedCore from "@/hooks/shared";

const { coverEditor, mixinState } = useSharedCore();

// 单选且等于组元素
let isGroup = computed(
  () => mixinState.mSelectMode === 'one' && mixinState.mSelectOneType === 'group'
);
// 是否为多选
let isMultiple = computed(() => mixinState.mSelectMode === 'multiple');

const handleUpdateValue = (value) => {
    if (value) {
        coverEditor.group()
    } else {
        coverEditor.unGroup()
    }
}

</script>